import 'package:taonile/generated/json/base/json_convert_content.dart';
import 'package:taonile/entity/coin_list_entity.dart';

CoinListEntity $CoinListEntityFromJson(Map<String, dynamic> json) {
	final CoinListEntity coinListEntity = CoinListEntity();
	final int? code = jsonConvert.convert<int>(json['code']);
	if (code != null) {
		coinListEntity.code = code;
	}
	final String? msg = jsonConvert.convert<String>(json['msg']);
	if (msg != null) {
		coinListEntity.msg = msg;
	}
	final List<CoinListData>? data = jsonConvert.convertListNotNull<CoinListData>(json['data']);
	if (data != null) {
		coinListEntity.data = data;
	}
	return coinListEntity;
}

Map<String, dynamic> $CoinListEntityToJson(CoinListEntity entity) {
	final Map<String, dynamic> data = <String, dynamic>{};
	data['code'] = entity.code;
	data['msg'] = entity.msg;
	data['data'] =  entity.data.map((v) => v.toJson()).toList();
	return data;
}

CoinListData $CoinListDataFromJson(Map<String, dynamic> json) {
	final CoinListData coinListData = CoinListData();
	final String? id = jsonConvert.convert<String>(json['id']);
	if (id != null) {
		coinListData.id = id;
	}
	final String? symbol = jsonConvert.convert<String>(json['symbol']);
	if (symbol != null) {
		coinListData.symbol = symbol;
	}
	final String? name = jsonConvert.convert<String>(json['name']);
	if (name != null) {
		coinListData.name = name;
	}
	final String? image = jsonConvert.convert<String>(json['image']);
	if (image != null) {
		coinListData.image = image;
	}
	final String? currentPrice = jsonConvert.convert<String>(json['current_price']);
	if (currentPrice != null) {
		coinListData.currentPrice = currentPrice;
	}
	final String? marketCap = jsonConvert.convert<String>(json['market_cap']);
	if (marketCap != null) {
		coinListData.marketCap = marketCap;
	}
	final String? marketCapRank = jsonConvert.convert<String>(json['market_cap_rank']);
	if (marketCapRank != null) {
		coinListData.marketCapRank = marketCapRank;
	}
	final String? fullyDilutedValuation = jsonConvert.convert<String>(json['fully_diluted_valuation']);
	if (fullyDilutedValuation != null) {
		coinListData.fullyDilutedValuation = fullyDilutedValuation;
	}
	final String? totalVolume = jsonConvert.convert<String>(json['total_volume']);
	if (totalVolume != null) {
		coinListData.totalVolume = totalVolume;
	}
	final String? high24h = jsonConvert.convert<String>(json['high_24h']);
	if (high24h != null) {
		coinListData.high24h = high24h;
	}
	final String? low24h = jsonConvert.convert<String>(json['low_24h']);
	if (low24h != null) {
		coinListData.low24h = low24h;
	}
	final String? priceChange24h = jsonConvert.convert<String>(json['price_change_24h']);
	if (priceChange24h != null) {
		coinListData.priceChange24h = priceChange24h;
	}
	final String? priceChangePercentage24h = jsonConvert.convert<String>(json['price_change_percentage_24h']);
	if (priceChangePercentage24h != null) {
		coinListData.priceChangePercentage24h = priceChangePercentage24h;
	}
	final String? marketCapChange24h = jsonConvert.convert<String>(json['market_cap_change_24h']);
	if (marketCapChange24h != null) {
		coinListData.marketCapChange24h = marketCapChange24h;
	}
	final String? marketCapChangePercentage24h = jsonConvert.convert<String>(json['market_cap_change_percentage_24h']);
	if (marketCapChangePercentage24h != null) {
		coinListData.marketCapChangePercentage24h = marketCapChangePercentage24h;
	}
	final String? circulatingSupply = jsonConvert.convert<String>(json['circulating_supply']);
	if (circulatingSupply != null) {
		coinListData.circulatingSupply = circulatingSupply;
	}
	final String? totalSupply = jsonConvert.convert<String>(json['total_supply']);
	if (totalSupply != null) {
		coinListData.totalSupply = totalSupply;
	}
	final String? maxSupply = jsonConvert.convert<String>(json['max_supply']);
	if (maxSupply != null) {
		coinListData.maxSupply = maxSupply;
	}
	final String? ath = jsonConvert.convert<String>(json['ath']);
	if (ath != null) {
		coinListData.ath = ath;
	}
	final String? athChangePercentage = jsonConvert.convert<String>(json['ath_change_percentage']);
	if (athChangePercentage != null) {
		coinListData.athChangePercentage = athChangePercentage;
	}
	final String? athDate = jsonConvert.convert<String>(json['ath_date']);
	if (athDate != null) {
		coinListData.athDate = athDate;
	}
	final String? atl = jsonConvert.convert<String>(json['atl']);
	if (atl != null) {
		coinListData.atl = atl;
	}
	final String? atlChangePercentage = jsonConvert.convert<String>(json['atl_change_percentage']);
	if (atlChangePercentage != null) {
		coinListData.atlChangePercentage = atlChangePercentage;
	}
	final String? atlDate = jsonConvert.convert<String>(json['atl_date']);
	if (atlDate != null) {
		coinListData.atlDate = atlDate;
	}
	final String? roi = jsonConvert.convert<String>(json['roi']);
	if (roi != null) {
		coinListData.roi = roi;
	}
	final String? lastUpdated = jsonConvert.convert<String>(json['last_updated']);
	if (lastUpdated != null) {
		coinListData.lastUpdated = lastUpdated;
	}
	return coinListData;
}

Map<String, dynamic> $CoinListDataToJson(CoinListData entity) {
	final Map<String, dynamic> data = <String, dynamic>{};
	data['id'] = entity.id;
	data['symbol'] = entity.symbol;
	data['name'] = entity.name;
	data['image'] = entity.image;
	data['current_price'] = entity.currentPrice;
	data['market_cap'] = entity.marketCap;
	data['market_cap_rank'] = entity.marketCapRank;
	data['fully_diluted_valuation'] = entity.fullyDilutedValuation;
	data['total_volume'] = entity.totalVolume;
	data['high_24h'] = entity.high24h;
	data['low_24h'] = entity.low24h;
	data['price_change_24h'] = entity.priceChange24h;
	data['price_change_percentage_24h'] = entity.priceChangePercentage24h;
	data['market_cap_change_24h'] = entity.marketCapChange24h;
	data['market_cap_change_percentage_24h'] = entity.marketCapChangePercentage24h;
	data['circulating_supply'] = entity.circulatingSupply;
	data['total_supply'] = entity.totalSupply;
	data['max_supply'] = entity.maxSupply;
	data['ath'] = entity.ath;
	data['ath_change_percentage'] = entity.athChangePercentage;
	data['ath_date'] = entity.athDate;
	data['atl'] = entity.atl;
	data['atl_change_percentage'] = entity.atlChangePercentage;
	data['atl_date'] = entity.atlDate;
	data['roi'] = entity.roi;
	data['last_updated'] = entity.lastUpdated;
	return data;
}